package cn.ito.zjgsu.domain.wrapper;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.alibaba.fastjson.JSON;

import cn.ito.zjgsu.domain.IndustryType;

public class IndustryTypeWrapper {
	public static final boolean INDUSTRYTYPE_EXIST_FLAG = true;;
	public static final boolean INDUSTRYTYPE_DELETE_FLAG = false;
	
	private IndustryType industryType;

	public IndustryTypeWrapper(IndustryType industryType) {
		this.industryType = industryType;
	}

	public IndustryTypeWrapper() {}
	
	public IndustryType getIndustry() {
		return industryType;
	}

	public void setIndustry(IndustryType industry) {
		this.industryType = industry;
	}
	
	public String toJsonString(){
		return JSON.toJSONString(this);
	}
	
	public static String toJsonArrayString(List<IndustryTypeWrapper> industryWrappers){
		return JSON.toJSONString(industryWrappers);
	}
	
	public static IndustryTypeWrapper gettestEntry(){
		IndustryType industryType = new IndustryType();
		industryType.setIndustryTypeCreatetime(new Date());
		industryType.setIndustryTypeId(1);
		industryType.setIndustryTypeName("test");
		industryType.setItDeleteTags(true);
		IndustryTypeWrapper industryWrapper = new IndustryTypeWrapper();
		industryWrapper.setIndustry(industryType);
		return industryWrapper;
		
	}
	
	
	public static String toJsonArrayString(IndustryTypeWrapper industryTypeWrapper){
		return JSON.toJSONString(industryTypeWrapper);
	}
	
	public static void testSelf(){
		System.out.println(gettestEntry().toJsonString());
	}
	
	public static List<IndustryTypeWrapper> wrapList(List<IndustryType> industryTypes){
		List<IndustryTypeWrapper> itws = new ArrayList<IndustryTypeWrapper>();
		for(IndustryType it : industryTypes){
			itws.add(new IndustryTypeWrapper(it));
		}
		return itws;
	}
}
